//
//  LocalDataProvider.m
//  Ghac 4S
//
//  Created by apple on 11-9-2.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "LocalDataProvider.h"
@implementation LocalDataProvider
//-(id)initWithDelegate:(id)delegate
//{
//    if ((self = [super initWithDelegate:delegate]))
//    {
//    }
//    return self;
//}
-(void)loadDataWithResource:(NSString *)source
{
//    KURLLoader* loader = [[KURLLoader alloc] initWithDelegate:self];
//    NSURL* url = [[NSURL alloc] initWithString:source];
//    
//    KURLRequest* request = [[KURLRequest alloc] initWithURL:url];
//    [loader addEventListener:KLOADER_COMPLETE sector:@selector(loadComplete:)];
//    [loader addEventListener:KLOADER_ERROR sector:@selector(loadError:)];
//    NSLog(@"load %@", source);
//    [loader load:request];
//    [request release];
//    [url release];
//    [loader release];
    NSData* data = [[NSData alloc] initWithContentsOfFile:source];
    if (data == Nil)
    {
        [self.deletageTarget performSelector:@selector(onError:) withObject:Nil afterDelay:0.1];
    }
    else
    {
        [self.deletageTarget performSelector:@selector(onData:) withObject:data afterDelay:0.1];
        [data release];
    }
    
}
//-(void) loadComplete:(id)sender
//{
//    [self.deletageTarget onData:((KURLLoader*)sender).data];
//}
//-(void) loadError:(id)sender
//{
//    [self.deletageTarget onError:Nil];
//}
@end
